# In python, it is called "Entry box"

import sys
from tkinter import *

# Note that get() method is used to access the text contents from the entry box variable
def button1Command():
    print(textInTheTextbox.get())
    label2 = Label(mainWindow, text=textInTheTextbox.get()).pack()

mainWindow = Tk()
mainWindow.geometry("300x100+200+200")
mainWindow.title("Textbox")
# The text in each entrybox has to be stored in a variable which must be defined as StringVar() datatype
textInTheTextbox = StringVar()

label1 = Label(mainWindow, text="Demonstration of using an Entry box").pack()
# The textvariable property is used to assign the contents of the entrybox to a variable
entryBox = Entry(mainWindow, textvariable=textInTheTextbox).pack()
button1 = Button(mainWindow, command=button1Command, text="Button1").pack()




mainWindow.mainloop()
